package com.lhb.common.components;

import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

public class LeftPanelButton extends JButton {




    public LeftPanelButton(String text) {

        setText(text);

        setFocusPainted(false);//去除焦点边框
        setBorderPainted(false);//去除最外边边框
        setBackground(Color.DARK_GRAY);//设置背景色深灰色
        setForeground(Color.WHITE);//设置前景色白色
        setCursor(new Cursor(Cursor.HAND_CURSOR));
        addMouseListener(new MouseAdapter() {
           @Override
           public void mouseClicked(MouseEvent e) {

               setBackground(Color.WHITE);

               setForeground(Color.GRAY);
           }

           @Override
           public void mouseEntered(MouseEvent e) {

               setBackground(Color.GRAY);
           }

           @Override
           public void mouseExited(MouseEvent e) {
               setForeground(Color.WHITE);
               setBackground(Color.DARK_GRAY);
           }
       });

    }



}
